package cn.edu.sicnu.cs.lgy.myapplication

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.synthetic.main.fragment_blank2.*
import kotlinx.android.synthetic.main.fragment_blank2.textView
import kotlinx.android.synthetic.main.fragment_blank3.*

// TODO: Rename parameter arguments, choose names that match
private const val ARG_PARAM1 = "student"

class BlankFragment3 : Fragment() {
    // TODO: Rename and change types of parameters
    private var stu: Student? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            stu = it.getSerializable(ARG_PARAM1) as Student
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_blank3, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        name.text = stu?.name
    }

    companion object {

        // TODO: Rename and change types and number of parameters
        @JvmStatic
        fun newInstance(stu: Student) =
            BlankFragment3().apply {
                arguments = Bundle().apply {
                    putSerializable(ARG_PARAM1, stu)
                }
            }
    }
}